package com.alipay.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092000554903";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQCfoW1db3cl/TTW+aVB8/xCVKl0d9fx6SVwnhr1fcc8h847uQprntMYSQtpy7WKbEdR8QQwyQ+74oTZ0k31PpU67Vum8TlZK1/+xOeuI/Pkup6PlwPNXCQavHC9SUWWcWjTrK0qWT4W5LUJrOezN8IvgQuFqZPMA9+exhu935yflGFJTyI3g+qsm+8ankQ5fNw8wTtCfaFq1HyEoGv4IMbsMcZe9NDElx9TW2Af/SMrg2rv3x5QW+L1F4Wvj+lfbY0jyUi2PYQ4/8wWkZw+1w7qAzdKSz7ahaVGET+TILAbxbG95swEph4z+nBJ00g6FF/G51KAmswgPFnFFROWtaI/AgMBAAECggEBAIEhXc4CuFizzsXEZ0nF7B9gS0AbHkXj+1RxoY9LMxulJFCtrF9IuKzhkekAUBfs5XjExkYMr7ymTh/CfyvPd3qWvdh7NJAMhXgbour8zHQP/upbGElMqywxmeWVW0SK82igO+iRDqgIVObBxyD0DxLMihyTBCs6SvAuhAyB0jpHyWR1c6l0eLmm8AQ8DTUrF1G64tmZQRAK3wi6XX/mNf9K620Antl/p2d5XZqpvp1nmLtVIW9QVozGXjwRHxHRaoOmu0t6i4S5LfVfysx9hFp9ibJNTotvk/uokYReFs8y+BcSmAeHPx1/XffHMbC8zEIkX4Y3oM1mx0VTPNeRuBECgYEA9ca6FZftGuEKKB/f6zQnzsaQpHvucOA5CItBgX3zUoH+m701+0GJ+OkGwEk60PRe+KpQZq3RPZPuxqDEarl/1Wq0x/7PDBZd5cdNehhqS7ZbYZNU7NA4v1jpaEN05l9wQ3XP3zYNz5VQg/qMwB2dDW5GAAnGXEprsVPR7PEgl+cCgYEApkVVjfa+bmqkYmJ2I+XcgiL0U8mxVzbLL4DbHfEKWEoS+WDSW5B0KLGmBz0DNGbKyzbQ1a1+lFaLujtQnq7Pr4S6ydLpwj8q2fWsYwdegjI2Wg3d0dxDBWx0iBSIzCsC6htcmENuih3vSDOSYC/TyysgCDLpZg/A2Fz4GcE5d+kCgYEAz8HANVaq2GjYtBhVqTX6XIFfbZtRcNspev50TikQ0XMPrcig5BZ/sggRa+O7Mz0PNvaJZnKSCJKPahomTu0lkVtVHCZaESarEvyJkqcm2393+aCYTmKpRZ68FyXGoKKWfIAPSukffZUDbb0S06d0xhCsXYXlxsgmBs0LDFa8LYsCgYA7AbwdB4YJdXslF0BJ+RdKb9E5swhmpSFymE4q0BIVxyP4sG225Qr0Lid3xiVPAXPSrn9qdYnIZvZrfwVbazp1VatcWKdwsi4o79DfzAu0NNGpH+aqxXpbgGPSr0bk/haoslEoEDY4eesjOnol/JMzNPjHMBo4iDquDkBWE4arkQKBgEvf24jabQKh1KzOwVYRxJq2yP/ow1z9vfChC5Pns/y3a4UIF/42rtBbb9FThfsLBQaUw4UbE9RMvvc1ygCr/MJ0IxiOy2X8c1tOOjRJHC7bEorRYMSGEnTCX6hG6gj1gk/iffnJW6ZzPx/PasbIcY2I9gfY53c7IiHwGA/rbWVV";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA7E3FBBvaPpzcGFLe7OQs81MFXHi7FKLX6JB0cC8D0dhpU6pu3cKfqDTya42+/UNfpEvsG6WaUuSiTFXVaaGd8RosfrMtuYsP3BqyRtTB9AvpxTHK7hBkWGiOGbUBTNxbDvCO7aaySAUS7VjlMQP3SeoURnnd+b7SPkG7tqSXwWxLaiEGT9vGTt+DXnuyH5FuAuvviq46DlTnf+yIUQnl9dQxbP47uRInNZdB/wIvHgiEtdR+VcnJpinqJLkxNu+9n9E7g+7HxfJW4e2XG8BoJsg2xXgFQ7j+XWzqLoP55oH3UJJLDS7OZnai8sx+SNmmQJmYgoHtDyVhK7VGmmh5PwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
        public static String notify_url = "http://localhost:8080/patient/zhifu";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://localhost:8080/patient/zhifu";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关https://openapi.alipaydev.com/gateway.do
//	public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

